// Core_UnitTest.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

class TestClass
{
public:
	TestClass()
		: mX(0)
		, mHeight(0.0f)
	{
	}

	int mX;
	float mHeight;
};

int _tmain(int argc, _TCHAR* argv[])
{
	MOE::Core::ClassMeta intMeta("Int", MOE::Core::BasicType::kInt32, MOE::Core::Int32TypeOperator::kSize, MOE::Core::Int32TypeOperator::CopyData, MOE::Core::Int32TypeOperator::CopyArray);
	MOE::Core::ClassMeta floatMeta("Float", MOE::Core::BasicType::kFloat32, MOE::Core::Float32TypeOperator::kSize, MOE::Core::Float32TypeOperator::CopyData, MOE::Core::Float32TypeOperator::CopyArray);

	MOE::Core::ClassMeta testClassMeta("TestClass", sizeof(TestClass));

	MOE::Core::Type* xFieldType = new MOE::Core::Type(intMeta);
	MOE::Core::Field* xField = new MOE::Core::Field(testClassMeta, "X", *xFieldType, offsetof(TestClass, mX));

	MOE::Core::Type* heightFieldType = new MOE::Core::Type(floatMeta);
	MOE::Core::Field* heightField = new MOE::Core::Field(testClassMeta, "Height", *heightFieldType, offsetof(TestClass, mHeight));

	testClassMeta.AddField(xField);
	testClassMeta.AddField(heightField);

	TestClass testObject;

	MOE::Core::BasicTypeHelpers::Write(xField, 1, &testObject);

	printf("%d\n", testObject.mX);

	testObject.mX = 2;
	int i;
	xField->ReadValue(&testObject, &i);

	printf("%d\n", i);

	if (MOE::Core::BasicTypeHelpers::IsSupportedBasicType<int>::Value)
	{
		printf("int is a supported type!\n");
	}

	if (!MOE::Core::BasicTypeHelpers::IsSupportedBasicType<TestClass>::Value)
	{
		printf("TestClass is not a supported type!\n");
	}

	MOE::Core::tHashValue nullhash = MOE::Core::StringToHash(nullptr);
	printf("Hash of nullptr is %u\n", nullhash);

	return 0;
}
